package com.permission.model;

import com.fasterxml.jackson.annotation.*;
import com.solution.framework.model.BaseBean;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
* Created with generator tools.
* User: sunguangzhu
* DateTime:2014-04-28 09:39:14
*/
@Entity
@Table(name = "t_p_user")
public class PUser extends BaseBean implements java.io.Serializable {

/**
* 名称
*/
private java.lang.String name;

/**
* 登录名称
*/
private java.lang.String loginname;

/**
* 电子邮件
*/
private java.lang.String email;

/**
* 密码
*/
private java.lang.String password;

/**
* 是否可用
*/
private boolean enable;

/**
* 归属部门
*/
private  com.permission.model.PDept pDept;

/**
* 用户角色集合
*/
private java.util.Set<com.permission.model.PUserRole> pUserRoles;

/** default constructor */
public PUser() {
}

/**
* full constructor
* @param name
* @param loginname
* @param email
* @param password
* @param enable
* @param pDept
* @param pUserRoles
*/
public PUser(java.lang.String name,java.lang.String loginname,java.lang.String email,java.lang.String password,boolean enable, com.permission.model.PDept pDept,java.util.Set<com.permission.model.PUserRole> pUserRoles) {
this.name=name;
this.loginname=loginname;
this.email=email;
this.password=password;
this.enable=enable;
this.pDept=pDept;
this.pUserRoles=pUserRoles;
}

/**
*  getter
*/
    @Column
public java.lang.String getName() {
return this.name;
}

/**
* setter
* @param name
*/
public void setName(java.lang.String name) {
this.name = name;
}

/**
*  getter
*/
    @Column
public java.lang.String getLoginname() {
return this.loginname;
}

/**
* setter
* @param loginname
*/
public void setLoginname(java.lang.String loginname) {
this.loginname = loginname;
}

/**
*  getter
*/
    @Column
public java.lang.String getEmail() {
return this.email;
}

/**
* setter
* @param email
*/
public void setEmail(java.lang.String email) {
this.email = email;
}

/**
*  getter
*/
    @Column
public java.lang.String getPassword() {
return this.password;
}

/**
* setter
* @param password
*/
public void setPassword(java.lang.String password) {
this.password = password;
}

/**
*  getter
*/
    @Column
public boolean getEnable() {
return this.enable;
}

/**
* setter
* @param enable
*/
public void setEnable(boolean enable) {
this.enable = enable;
}

/**
*  getter
*/
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "pDept_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_puser_pDept")
public  com.permission.model.PDept getPDept() {
return this.pDept;
}

/**
* setter
* @param pDept
*/
public void setPDept( com.permission.model.PDept pDept) {
this.pDept = pDept;
}

/**
*  getter
*/
    @JsonBackReference
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "PUser")
public java.util.Set<com.permission.model.PUserRole> getPUserRoles() {
return this.pUserRoles;
}

/**
* setter
* @param pUserRoles
*/
public void setPUserRoles(java.util.Set<com.permission.model.PUserRole> pUserRoles) {
this.pUserRoles = pUserRoles;
}

}
